<!--
  组件名称：图片查看
 -->
<template>
  <div style="height: 300px;overflow-y: scroll;font-size: 14px;">
   <PreviewGroup :group="slide" />
  </div>
</template>
<script>
import PreviewGroup from './../../../custom/vue-preview/PreviewGroup'
export default {
  name: 'PictureView',
  data () {
    return {
      slide: [
      ]
    }
  },
  components: {PreviewGroup},
  mounted () {
    this.getData()
  },
  watch: {
    row () {
      this.getData()
    }
  },
  methods: {
    // 加载数据
    getData () {
      // 处理数据源获得url与参数
      let {url, param} = this.$handleSrc(this.src, {row: this.row})
      let _this = this
      // 发送请求
      this.$postJSON(url, param)
        .then(data => {
        // 加工获得的数据，从请求到数据中以指定键加载x与y轴数据
          for (let obj of data) {
            this.slide.push(
              {
                imgsrc: 'http://172.16.238.17:8080/' + obj['DIR'],
                alt: 'picture1',
                title: new Date(obj['YMDHM']).format('yyyy-MM-dd hh:mm:ss'),
                mw: 170,
                mh: 110
              }
            )
          }
        })
    }
  },
  props: [
    'row',
    'src',
    // 附加数据
    'addition'
  ]
}
</script>
<style scoped>

</style>
